package com.lzh.others.basejava.Reflection;

import java.lang.reflect.Field;


/**
 * 2.如何获得类的值
 */
public class Main_02 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException {
        Class<?> aClass1 = Class.forName("com.lzh.others.basejava.Reflection.User");
        Field publicStaticField = aClass1.getDeclaredField("publicStaticField");
        Field privateStaticField = aClass1.getDeclaredField("privateStaticField");
        privateStaticField.setAccessible(true);
        System.out.println(publicStaticField.get(null));
        System.out.println(privateStaticField.get(null));
    }
}
